<template>
  <div>
    <el-dialog title="编辑" :visible.sync="dialogVisible" width="500px" :before-close="closeEditDialog"
      :close-on-click-modal="false" :modal-append-to-body="false">
      <el-form :model="editInfo" :rules="rules" ref="refEditInfo" label-width="100px">

        <el-form-item size="small" label="配置值">
          <el-input clearable v-model="editInfo.configValue" placeholder="请输入配置值"></el-input>
        </el-form-item>

        <el-form-item size="small" label="备注">
          <el-input type="textarea" :rows="3" placeholder="备注" v-model="editInfo.remark" maxlength="30" resize='none' :autosize="{ minRows: 2, maxRows: 5 }"></el-input>
        </el-form-item>

      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="closeEditDialog" class="cancel-button">取 消</el-button>
        <el-button size="small" @click="editSubmit" v-preventReClick="1000" class="confirm-button">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { reqeSystemConfigEdit } from "@/api/api";

export default {
  name: "editTeacherMemebr",
  props: ["editInfo"],
  data() {
    return {
      dialogVisible: false,
      // 表单验证规则
      rules: {},
    };
  },
  watch: {},
  methods: {
    // 点击修改
    editSubmit() {
      this.$refs.refEditInfo.validate(async (valid) => {
        if (valid) {
          const res = await reqeSystemConfigEdit(this.editInfo);
          if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
          this.$modal.notifySuccess("修改配置信息成功");
          this.closeEditDialog()
          this.$parent.SystemConfigList();
        }
      });
    },
    // 点击关闭弹框
    closeEditDialog() {
      this.$refs.refEditInfo.resetFields();
      this.dialogVisible = false;
    },
  },
};
</script>

<style lang="less" scoped>
@import url("../../common.less");
</style>